package javase;

import java.io.FileInputStream;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.List;

public class Demo {
    static List<Student> list = new ArrayList<>();

    static {
        list.add(new Student(1, 12, "张飞"));
        list.add(new Student(1, 17, "张顺"));
        list.add(new Student(1, 21, "李逵"));
        list.add(new Student(1, 22, "李雷"));
        list.add(new Student(1, 15, "张超"));
        list.add(new Student(0, 19, "张雨"));
        list.add(new Student(0, 11, "刘邦"));
        list.add(new Student(0, 26, "刘佩"));
        list.add(new Student(0, 24, "李斯"));
        list.add(new Student(20, 25, "李白"));
    }

    static class Student {
        int id;
        int age;
        String name;

        public Student(int id, int age, String name) {
            this.id = id;
            this.age = age;
            this.name = name;
        }

        public int getId() {
            return id;
        }

        @Override
        public String toString() {
            return id + " " + age + " " + name;
        }
    }

    public static void main(String[] args) throws InterruptedException {
//        for (Student s : list) {
//            System.out.println(s.name);
//        map.computeIfPresent(1, (k, v) -> v - 1);
//        map.merge(1, -1, Integer::sum);
//        }

//        Student student = Optional.ofNullable(list).
//                map(students -> students.get(0))
//                .orElse(new Student(1, 1, "2"));
//        System.out.println(student);
    }
}
